package cn.xspace.wnx.activity;

import android.os.Bundle;
import android.view.View;

import com.xspace.android.xafcommon.base.BaseActivity;

import java.util.Map;

import cn.xspace.app.view.TitleBar;
import cn.xspace.library.util.BldNavigation;
import cn.xspace.wnx.R;
import cn.xspace.chatui.bean.MsgRecordEntity;
import cn.xspace.wnx.fragment.AddressBookFragment;

/**
 * 转发的界面,添加了一个AddressBookFragment,并将转发的内容传递了进去
 * Created by liuchen on 2016/11/10.
 */
public class MsgForwardActivity extends BaseActivity {
    public static final String TAG = "MsgForwardActivity";
    private MsgRecordEntity recordEntity;
    public static final String FORWARD_ENTITY = "forward_entity";
    public static final String FORWORD = "forword";

    private TitleBar mTitlebar;

    @Override
    protected void getIntentData() {
        super.getIntentData();
        Bundle mBundle = getIntent().getBundleExtra(BldNavigation.KEY_BUNDLER);
        if (mBundle != null) {
            recordEntity = (MsgRecordEntity) mBundle.getSerializable(FORWARD_ENTITY);
        }
    }

    @Override
    protected void initView() {
        super.initView();
        setContentView(R.layout.activity_forward);
    }

    @Override
    protected void initFindViewById() {
        super.initFindViewById();
        mTitlebar = (TitleBar) findViewById(R.id.title_bar);
        Bundle mBundle = new Bundle();
        mBundle.putSerializable(FORWARD_ENTITY, recordEntity);
        mBundle.putString(FORWORD, FORWORD);
        getSupportFragmentManager().beginTransaction().add(R.id.framelayout, AddressBookFragment.newInstance(mBundle)).commit();
    }

    @Override
    protected void initData() {
        super.initData();
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        mTitlebar.setLeftLayoutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }

    @Override
    public void onEventMainThread(Map<String, Object> inParam) {
        super.onEventMainThread(inParam);
    }
}
